#include "..\headers\ListOf.h"

int main() {
  int num;
  scanf("%d", &num);
  int a[num], b[num], c[num];
  for (int i = 0; i < num; i++) scanf("%d", &a[i]);
  for (int i = 0; i < num; i++) scanf("%d", &b[i]);

  int j = 0, k = 0, cnt = 0, i = 0;
  while (cnt < (num * 2 + 1) / 2) {
    if (a[j] > b[k]) {
      c[i++] = b[k];
      k++;
    } else {
      c[i++] = a[j];
      j++;
    }
    cnt = k + j;
  }

  printf("%d", c[num - 1]);
}
